#pragma once

#include <client.h>
#include <connectionlistener.h>
#include <registration.h>

using namespace gloox;

class CXepdtRegistration:public RegistrationHandler, ConnectionListener
{
public:
	CXepdtRegistration();
	virtual ~CXepdtRegistration(void);

	virtual void onConnect();

	virtual void onDisconnect( ConnectionError e );

	virtual bool onTLSConnect( const CertInfo& info );

	virtual void handleRegistrationFields( const JID& /*from*/, int fields, std::string instructions );

    virtual void handleRegistrationResult( const JID& /*from*/, RegistrationResult result );
 
    virtual void handleAlreadyRegistered( const JID& /*from*/ );
    
    virtual void handleDataForm( const JID& /*from*/, const DataForm& /*form*/ );
    
    virtual void handleOOB( const JID& /*from*/, const OOB& oob );

public:
	RegistrationResult registerAccount(std::string& strServer, std::string& username, std::string& password);

private:
	RegistrationResult m_regResult;
    Registration *m_reg;
    Client *client;
	std::string user;
	std::string pwd;
};
